const app = getApp();
Component({
  /**
   * 组件的一些选项
   */
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的对外属性
   */
  properties: {
    isSave:{
      type:Boolean,
      default:true
    },
    bgColor: {
      type: String,
      default: ''
    }, 
    isCustom: {
      type: [Boolean, String],
      default: false
    },
    isBack: {
      type: [Boolean, String],
      default: false
    },
    bgImage: {
      type: String,
      default: ''
    },
    back:{
      type:Boolean,
      default:true
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar+10,
    Custom: app.globalData.Custom
  },
  /**
   * 组件的方法列表
   */
  created(){
    console.log( app.globalData.StatusBar,app.globalData.CustomBar,app.globalData.Custom)
  },
  methods: {
    BackPage() {
  
    this.triggerEvent('examine')
      if(this.data.back&&this.data.isSave){
        wx.showModal({
          cancelColor: 'cancelColor',
          title:'提示',
          content:'退出后草稿自动保存',
          confirmText:'退出',
          cancelText:'取消',
          cancelColor:'#DC143C',
          success:(res)=>{
            if(res.confirm){
              this.triggerEvent('addDrafts')
            }
          }
        })
      }else{
        wx.navigateBack({
          delta: 1
        });
      }
     
    },
    toHome(){
      wx.reLaunch({
        url: '/pages/index/home/home',
      })
    }
  }
})